<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class wait_list</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Compute">
<link rel="up" href="../../boost_compute/reference.html#header.boost.compute.utility.wait_list_hpp" title="Header &lt;boost/compute/utility/wait_list.hpp&gt;">
<link rel="prev" href="../../BOOST_COMPUTE_STR_idm11779.html" title="Macro BOOST_COMPUTE_STRINGIZE_SOURCE">
<link rel="next" href="../../boost_compute/performance.html" title="Performance">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../BOOST_COMPUTE_STR_idm11779.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_compute/reference.html#header.boost.compute.utility.wait_list_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../boost_compute/performance.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.compute.wait_list"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class wait_list</span></h2>
<p>boost::compute::wait_list — Stores a list of events. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_compute/reference.html#header.boost.compute.utility.wait_list_hpp" title="Header &lt;boost/compute/utility/wait_list.hpp&gt;">boost/compute/utility/wait_list.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">event</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">iterator</span>       <a name="boost.compute.wait_list.iterator"></a><span class="identifier">iterator</span><span class="special">;</span>      
  <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">event</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">const_iterator</span> <a name="boost.compute.wait_list.const_iterator"></a><span class="identifier">const_iterator</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="wait_list.html#boost.compute.wait_listconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="wait_list.html#idm11879-bb"><span class="identifier">wait_list</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html#idm11881-bb"><span class="identifier">wait_list</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">event</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html#idm11886-bb"><span class="identifier">wait_list</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html#idm11892-bb"><span class="identifier">wait_list</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">event</span> <span class="special">&gt;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html#idm11905-bb"><span class="identifier">wait_list</span></a><span class="special">(</span><a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span> <a class="link" href="wait_list.html#idm11897-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span> <a class="link" href="wait_list.html#idm11911-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="wait_list.html#idm11920-bb"><span class="special">~</span><span class="identifier">wait_list</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="wait_list.html#idm11806-bb">public member functions</a></span>
  <span class="keyword">bool</span> <a class="link" href="wait_list.html#idm11807-bb"><span class="identifier">empty</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">uint_</span> <a class="link" href="wait_list.html#idm11811-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="wait_list.html#idm11814-bb"><span class="identifier">clear</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">const</span> <span class="identifier">cl_event</span> <span class="special">*</span> <a class="link" href="wait_list.html#idm11817-bb"><span class="identifier">get_event_ptr</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="wait_list.html#idm11824-bb"><span class="identifier">reserve</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="wait_list.html#idm11829-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">event</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="wait_list.html#idm11835-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="future.html" title="Class template future">future</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="wait_list.html#idm11844-bb"><span class="identifier">wait</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">const</span> <span class="identifier">event</span> <span class="special">&amp;</span> <a class="link" href="wait_list.html#idm11849-bb"><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">event</span> <span class="special">&amp;</span> <a class="link" href="wait_list.html#idm11855-bb"><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span></a><span class="special">(</span><span class="identifier">size_t</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">iterator</span> <a class="link" href="wait_list.html#idm11861-bb"><span class="identifier">begin</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">const_iterator</span> <a class="link" href="wait_list.html#idm11864-bb"><span class="identifier">begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">const_iterator</span> <a class="link" href="wait_list.html#idm11867-bb"><span class="identifier">cbegin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">iterator</span> <a class="link" href="wait_list.html#idm11870-bb"><span class="identifier">end</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">const_iterator</span> <a class="link" href="wait_list.html#idm11873-bb"><span class="identifier">end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">const_iterator</span> <a class="link" href="wait_list.html#idm11876-bb"><span class="identifier">cend</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm39724"></a><h2>Description</h2>
<p>The <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> class stores a set of event objects and can be used to specify dependencies for OpenCL operations or to wait on the host until all of the events have completed.</p>
<p>This class also provides convenience functions for interacting with OpenCL APIs which typically accept event dependencies as a <code class="computeroutput">cl_event*</code> pointer and a <code class="computeroutput">cl_uint</code> size. For example: </p>
<pre class="programlisting"><span class="identifier">wait_list</span> <span class="identifier">events</span> <span class="special">=</span> <span class="special">...</span><span class="special">;</span>

<span class="identifier">clEnqueueNDRangeKernel</span><span class="special">(</span><span class="special">...</span><span class="special">,</span> <span class="identifier">events</span><span class="special">.</span><span class="identifier">get_event_ptr</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="identifier">events</span><span class="special">.</span><span class="identifier">size</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="special">...</span><span class="special">)</span><span class="special">;</span>
</pre>
<p><span class="bold"><strong>See Also:</strong></span></p>
<p>event, <a class="link" href="future.html" title="Class template future">future&lt;T&gt;</a> </p>
<p>
</p>
<p>
</p>
<div class="refsect2">
<a name="idm39761"></a><h3>
<a name="boost.compute.wait_listconstruct-copy-destruct"></a><code class="computeroutput">wait_list</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm11879-bb"></a><span class="identifier">wait_list</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Creates an empty wait-list. </li>
<li class="listitem">
<pre class="literallayout"><a name="idm11881-bb"></a><span class="identifier">wait_list</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">event</span> <span class="special">&amp;</span> event<span class="special">)</span><span class="special">;</span></pre>Creates a wait-list containing <code class="computeroutput">event</code>. </li>
<li class="listitem">
<pre class="literallayout"><a name="idm11886-bb"></a><span class="identifier">wait_list</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>Creates a new wait-list as a copy of <code class="computeroutput">other</code>. </li>
<li class="listitem">
<pre class="literallayout"><a name="idm11892-bb"></a><span class="identifier">wait_list</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">event</span> <span class="special">&gt;</span> events<span class="special">)</span><span class="special">;</span></pre>Creates a wait-list from <code class="computeroutput">events</code>. </li>
<li class="listitem">
<pre class="literallayout"><a name="idm11905-bb"></a><span class="identifier">wait_list</span><span class="special">(</span><a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>Move-constructs a new wait list object from <code class="computeroutput">other</code>. </li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span> <a name="idm11897-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>Copies the events in the wait-list from <code class="computeroutput">other</code>. </li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;</span> <a name="idm11911-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="wait_list.html" title="Class wait_list">wait_list</a> <span class="special">&amp;&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>Move-assigns the wait list from <code class="computeroutput">other</code> to <code class="computeroutput">*this</code>. </li>
<li class="listitem">
<pre class="literallayout"><a name="idm11920-bb"></a><span class="special">~</span><span class="identifier">wait_list</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destroys the wait-list. </li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm39863"></a><h3>
<a name="idm11806-bb"></a><code class="computeroutput">wait_list</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm11807-bb"></a><span class="identifier">empty</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns <code class="computeroutput">true</code> if the wait-list is empty. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">uint_</span> <a name="idm11811-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the number of events in the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm11814-bb"></a><span class="identifier">clear</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Removes all of the events from the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">const</span> <span class="identifier">cl_event</span> <span class="special">*</span> <a name="idm11817-bb"></a><span class="identifier">get_event_ptr</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns a cl_event pointer to the first event in the wait-list. Returns <code class="computeroutput">0</code> if the wait-list is empty.</p>
<p>This can be used to pass the wait-list to OpenCL functions which expect a <code class="computeroutput">cl_event</code> pointer to refer to a list of events. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm11824-bb"></a><span class="identifier">reserve</span><span class="special">(</span><span class="identifier">size_t</span> new_capacity<span class="special">)</span><span class="special">;</span></pre>Reserves a minimum length of storage for the wait list object. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm11829-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">event</span> <span class="special">&amp;</span> event<span class="special">)</span><span class="special">;</span></pre>Inserts <code class="computeroutput">event</code> into the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm11835-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="future.html" title="Class template future">future</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;</span> future<span class="special">)</span><span class="special">;</span></pre>Inserts the event from <code class="computeroutput">future</code> into the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm11844-bb"></a><span class="identifier">wait</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Blocks until all of the events in the wait-list have completed.</p>
<p>Does nothing if the wait-list is empty. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">const</span> <span class="identifier">event</span> <span class="special">&amp;</span> <a name="idm11849-bb"></a><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span><span class="special">(</span><span class="identifier">size_t</span> pos<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns a reference to the event at specified location <code class="computeroutput">pos</code>. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">event</span> <span class="special">&amp;</span> <a name="idm11855-bb"></a><span class="keyword">operator</span><span class="special">[</span><span class="special">]</span><span class="special">(</span><span class="identifier">size_t</span> pos<span class="special">)</span><span class="special">;</span></pre>Returns a reference to the event at specified location <code class="computeroutput">pos</code>. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">iterator</span> <a name="idm11861-bb"></a><span class="identifier">begin</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Returns an iterator to the first element of the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm11864-bb"></a><span class="identifier">begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns an iterator to the first element of the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm11867-bb"></a><span class="identifier">cbegin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns an iterator to the first element of the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">iterator</span> <a name="idm11870-bb"></a><span class="identifier">end</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Returns an iterator to the element following the last element of the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm11873-bb"></a><span class="identifier">end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns an iterator to the element following the last element of the wait-list. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm11876-bb"></a><span class="identifier">cend</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns an iterator to the element following the last element of the wait-list. </li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2013, 2014 Kyle Lutz<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../../BOOST_COMPUTE_STR_idm11779.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_compute/reference.html#header.boost.compute.utility.wait_list_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../boost_compute/performance.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
